package leetcode.code1513;

public class Solution {
	int mod = (int) 1e9 + 7;

	public int numSub(String s) {
		char[] cs = s.toCharArray();
		long ans = 0;
		for (int i = 0, z = -1; i < cs.length; i++) {
			char c = cs[i];
			if (c == '0') {
				z = i;
			} else {
				ans += i - z;
				ans %= mod;
			}
		}
		return (int) ans;
	}
}
